package algotithm.interview.民生科技test.test1;

import java.io.*;
import java.util.*;

/**
 * @author zhouyanxiang
 * @Date 2021-03-2021/3/6-19:15
 */
public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        // n个
        int n = Integer.parseInt(reader.readLine());
        // 价格
        int[] p = new int[n];
        String[] arr = reader.readLine().split(" ");
        for (int i = 0; i < arr.length; i++) {
            p[i] = Integer.parseInt(arr[i]);
        }
        int[] first = new int[n];
        int[] second = new int[n];
        String[] t1 = reader.readLine().split(" ");
        for (int i = 0 ;i < t1.length; i++) {
            first[i] = Integer.parseInt(t1[i]);
        }
        String[] t2 = reader.readLine().split(" ");
        for (int i = 0 ;i < t2.length; i++) {
            second[i] = Integer.parseInt(t2[i]);
        }
        int m = Integer.parseInt(reader.readLine());
        int[] t = new int[m];
        String[] str = reader.readLine().split(" ");
        for (int i = 0; i < str.length; i++) {
            t[i] = Integer.parseInt(str[i]);
        }


        List<Integer> list1 = new ArrayList<>();
        List<Integer> list2 = new ArrayList<>();
        List<Integer> list3 = new ArrayList<>();
//        for (int i = 0; i < n; i++) {
//            if (first[i] == 1|| second[i] == 1) {
//                list1.add()
//            }
//        }

        HashMap<Integer, Integer> map1 = new HashMap<>(26);
        HashMap<Integer, Integer> map2 = new HashMap<>(26);
        for (int i = 0;i < m; i++) {
            map1.put(p[i],first[i]);
            map2.put(p[i],second[i]);
        }
//        for (int i = 0; i < m; i++) {
//            if (map1.get(p[i]) == 1) {
//                list1.add()
//            }
//        }


        int[] res = new int[m];
        Arrays.fill(res,-1);
        for (int i = 0; i < m; i++) {
            // res[i] =
        }

        for (int i = 0; i < m; i++) {
            writer.write(res[i] + " ");
        }
        writer.write("\n");
        writer.flush();
        writer.close();
        reader.close();
    }

}
